package cn.jh.smartos.activity

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import cn.jh.smartos.R
import cn.jh.smartos.bean.ConnConfig
import kotlinx.android.synthetic.main.activity_splash.*

class SplashActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)
        rg_type.setOnCheckedChangeListener { radioGroup, i ->

            when (i) {
                R.id.rb_1 -> {
                    ConnConfig.isService = true
                }
                R.id.rb_2 -> {
                    ConnConfig.isService = false
                }
            }
        }
        if (ConnConfig.isService) {
            rg_type.check(R.id.rb_1)
        } else {
            rg_type.check(R.id.rb_2)
        }
        btn_toMain.setOnClickListener {

            startActivity(Intent(this, MainActivity::class.java))
            finish()
        }
    }
}
